home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / lockingKeyableWnd.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.8 KB  |  222 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc rebuildMenu(string $tabs, string $window)
  18. {
  19.     setParent LockingKeyable;
  20.     menu -e -dai Object;
  21.     setParent -m Object;
  22.     string $selected[] = `ls -sl -tail 20`;
  23.     int $numOfSelected = `size( $selected )`;
  24.     if( $numOfSelected == 0 ) 
  25.     {
  26.         menuItem -l "Nothing selected";
  27.     } 
  28.     else 
  29.     {
  30.         for( $item in $selected ) 
  31.         {
  32.             string $command = "MenuSelect" + " " + `tabLayout -q -st $tabs` + 
  33.                 " " + $item + " " + `tabLayout -q -st $tabs` + " " + $window;//$item;
  34.             menuItem -c $command -l $item;
  35.         }
  36.         if( $numOfSelected == 20 ) {
  37.             menuItem -l "<truncated>";
  38.         }
  39.     }
  40. }
  41.  
  42.  
  43.  
  44. global proc MenuSelect(string $commandStr, string $selection, string $parent,
  45.                         string $window)
  46. {
  47.     setParent LockingKeyable;
  48.  
  49.     int $childCount = `frameLayout -query -numberOfChildren $parent`;
  50.     string $command = "";
  51.  
  52.     if (0 == $childCount) 
  53.     {
  54.         $command = "PScreate" + $commandStr + "UI " + $parent + " " + 
  55.             $selection;
  56.     }
  57.     else
  58.     {
  59.         $command = "PSupdate" + $commandStr + "UI " + $parent + " " + 
  60.             $selection;
  61.     }
  62.  
  63.     eval $command;
  64.  
  65.     string $command = "UpdateTab " + $selection + " LKtabs " + $window;
  66.     tabLayout -e -preSelectCommand $command LKtabs;
  67.  
  68.     string $windowName = "Channel Control - " + $selection;
  69.  
  70.     window -e -t $windowName $window;
  71. }
  72.  
  73. global proc UpdateTab(string $selection, string $parent, string $window)
  74. {
  75.     setParent LockingKeyable;
  76.     string $tabSelected = `tabLayout -q -st $parent`;
  77.     
  78.     string $command = "MenuSelect " + $tabSelected + " " + $selection + " " + 
  79.         $tabSelected + " " + $window;    
  80.     eval $command;
  81. //    tabLayout -e -cc "" LKtabs;
  82. }
  83.  
  84. global proc autoUpdateCC()
  85. {
  86.     // don't do anything if the window is minimized
  87.     //
  88.     if ( `window -q -iconify LockingKeyable` ) {
  89.         return;
  90.     }
  91.  
  92.     string $command;
  93.        string $selected[] = `ls -sl -tail 20`;
  94.     int $numOfSelected = `size( $selected )`;
  95.  
  96.     setParent LockingKeyable;
  97.  
  98.  
  99.     if ((!(`frameLayout -exists warnFrame`))&&( $numOfSelected != 0 )) {
  100.  
  101.         tabLayout -e -tv true LKtabs;
  102.         string $command = "MenuSelect" + " " + `tabLayout -q -st LKtabs` +
  103.             " " + $selected[$numOfSelected-1] + " " + `tabLayout -q -st LKtabs` + " " +
  104.             "LockingKeyable";
  105.  
  106.         eval $command;
  107.     } else if( $numOfSelected != 0 ) {
  108.         if (`tabLayout -exists warnTab`) {
  109.             deleteUI warnTab;
  110.         }
  111.         tabLayout -e -tv true LKtabs;
  112.         tabLayout -e -st Keyable LKtabs;
  113.         string $command = "MenuSelect" + " " + `tabLayout -q -st LKtabs` +
  114.             " " + $selected[$numOfSelected-1] + " " + `tabLayout -q -st LKtabs` + " " +
  115.             "LockingKeyable";
  116.  
  117.         eval $command;
  118.     } else if (!`tabLayout -exists warnTab`) {
  119.         setParent LockingKeyable;
  120.         tabLayout warnTab;
  121.         frameLayout -bv false -lv false -cll false warnFrame; 
  122.         frameLayout -lv false warnFrame;
  123.         tabLayout -e -tv false  warnTab;
  124.         tabLayout -e -tv false  LKtabs;
  125.         tabLayout -e -st warnTab LKtabs;
  126.         text -l "There is nothing selected." warning;
  127.     }
  128.  
  129. }
  130.  
  131. global proc buildChannelControlContextHelpItems(string $nameRoot, string $menuParent)
  132. //
  133. //  Description:
  134. //        Build context sensitive menu items
  135. //        
  136. //  Input Arguments:
  137. //        $nameRoot - name to use as the root of all item names
  138. //        $menuParent - the name of the parent of this menu
  139. //
  140. //  Return Value:
  141. //      None
  142. //
  143. {
  144.     menuItem -label "Help on Channel Control..."
  145.         -enableCommandRepeat false
  146.         -command "showHelp ChannelControl";
  147. }
  148.  
  149. global proc lockingKeyableWnd()
  150. {
  151.     string $selected[] = `ls -sl -tail 20`;
  152.     int $numOfSelected = `size( $selected )`;
  153.     if ( `window -exists LockingKeyable` ) {
  154.         showWindow LockingKeyable;
  155.         return;
  156.     }
  157.  
  158.     window
  159.         -mb true
  160.         -w 500 -h 400
  161.         -t "Channel Control"
  162.         -iconName "Channels"
  163.         -mnc "window -e -rc autoUpdateCC -mnc \"\" LockingKeyable"
  164.         LockingKeyable;
  165.         
  166.     
  167.     
  168.     if(`about -mac`){
  169.         menu -p LockingKeyable
  170.             -l "Object"
  171.             -pmc "rebuildMenu LKtabs LockingKeyable" 
  172.             -familyImage "menuIconObject.xpm"
  173.             Object;
  174.     }
  175.  
  176.     //    Adds support for the Context Sensitive Help Menu.
  177.     //
  178.     addContextHelpProc "LockingKeyable" "buildChannelControlContextHelpItems";
  179.     doHelpMenu "LockingKeyable" "LockingKeyable";
  180.  
  181.     setUITemplate -pushTemplate NONE;
  182.  
  183.     scriptJob -p LockingKeyable -e "SelectionChanged" "autoUpdateCC";
  184.  
  185.     tabLayout LKtabs;
  186.  
  187.     frameLayout -lv false Keyable;
  188.     setParent ..;
  189.  
  190.     frameLayout -lv false Locking;
  191.     setParent ..;
  192.  
  193.     tabLayout -e -tl Keyable "Keyable" -tl Locking "Locked" -tv false LKtabs;
  194.     tabLayout -e -st Keyable LKtabs;
  195.     tabLayout -e -tv false LKtabs;
  196.  
  197.     if(!`about -mac`){
  198.         menu -p LockingKeyable 
  199.             -l "Object"
  200.             -pmc "rebuildMenu LKtabs LockingKeyable" 
  201.             -familyImage "menuIconObject.xpm"
  202.             Object;
  203.     }
  204.  
  205.     if( $numOfSelected != 0 )
  206.     {
  207.         autoUpdateCC;
  208.     }
  209.     else
  210.     {
  211.         tabLayout warnTab;
  212.         frameLayout -bv false -lv false -cll false warnFrame; 
  213.         frameLayout -lv false warnFrame;
  214.         tabLayout -e -tv false  warnTab;
  215.         tabLayout -e -st warnTab LKtabs;
  216.         text -l "There is nothing selected." warning;
  217.     }
  218.     setUITemplate -popTemplate;
  219.  
  220.     showWindow LockingKeyable;
  221. }
  222.